﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace _02_委托的必要性_1
{
    public delegate void DelChangeButtonEanble(bool enable);

    public partial class Form1 : Form
    {
        public static DelChangeButtonEanble delChangeButtonEanble = null;

        public Form1()
        {
            InitializeComponent();
            //实例化委托对象
            delChangeButtonEanble = new DelChangeButtonEanble(ChangeButtonEanble);
        }
        /// <summary>
        /// 打开子窗体
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button1_Click(object sender, EventArgs e)
        {
            Form2 form2 = new Form2();
            form2.Show();
        }

        public void ChangeButtonEanble(bool enable)
        {
            this.button1.Enabled = enable;
        }


    }
}
